package com.x.mvp.widget.cycleview;

import android.support.v4.view.ViewPager;
import android.view.View;

/**
 * Created by H on 17/11/1.
 */

public class LoopZoomPagerTransformer implements ViewPager.PageTransformer {
    @Override
    public void transformPage(View page, float position) {
        if (position >= -1.0f && position <= 0.0f) {
            // 控制左侧滑入或者划出View缩放比例
            page.setScaleX(1 + position * 0.1f);
            page.setScaleY(1 + position * 0.2f);
        } else if (position > 0.0f && position <= 1.0f) {
            // 控制右侧滑入或者划出View缩放比例
            page.setScaleX(1 - position * 0.1f);
            page.setScaleY(1 - position * 0.2f);
        } else {
            // 控制其它View缩放比例
            page.setScaleX(0.9f);
            page.setScaleY(0.8f);
        }
    }
}
